home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 5 / QRZ Ham Radio Callsign Database - Volume 5.iso / files / tcpip / amiga / asrc29p.lha / kissdump.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-29  |  1.2 KB  |  70 lines

  1. #include "global.h"
  2. #include "mbuf.h"
  3. #include "kiss.h"
  4. #include "ax25.h"
  5. #include "trace.h"
  6.  
  7. void
  8. ki_dump(fp,bpp,check)
  9. FILE *fp;
  10. struct mbuf **bpp;
  11. int check;
  12. {
  13.     char type;
  14.     char val;
  15.  
  16.     fprintf(fp,"KISS: ");
  17.     type = PULLCHAR(bpp);
  18.     if((type & 0x0f) == KISS_DATA){
  19.         fprintf(fp,"Port %d Data\n", type >> 4);
  20.         ax25_dump(fp,bpp,check);
  21.         return;
  22.     }
  23.     if(type == KISS_RETURN){
  24.         fprintf(fp,"RETURN\n");
  25.         return;
  26.     } else {
  27.         fprintf(fp,"Port %d ", type >> 4);
  28.     }
  29.     val = PULLCHAR(bpp);
  30.     switch(type & 0x0f){
  31.     case KISS_TXD:
  32.         tprintf("TX Delay: %lu ms\n",uchar(val) * 10L);
  33.         break;
  34.     case KISS_P:
  35.         tprintf("Persistence: %u/256\n",uchar(val) + 1);
  36.         break;
  37.     case KISS_ST:
  38.         tprintf("Slot time: %lu ms\n",uchar(val) * 10L);
  39.         break;
  40.     case KISS_TXT:
  41.         tprintf("TX Tail time: %lu ms\n",uchar(val) * 10L);
  42.         break;
  43.     case KISS_FD:
  44.         tprintf("Duplex: %s\n",uchar(val) == 0 ? "Half" : "Full");
  45.         break;
  46.     case KISS_HW:
  47.         tprintf("Hardware %u\n",uchar(val));
  48.         break;
  49.     default:
  50.         fprintf(fp,"code %u arg %u\n",uchar(type),uchar(val));
  51.         break;
  52.     }
  53. }
  54.  
  55. int
  56. ki_forus(iface,bp)
  57. struct iface *iface;
  58. struct mbuf *bp;
  59. {
  60.     struct mbuf *bpp;
  61.     int i;
  62.  
  63.     if((bp->data[0] & 0x0f) != KISS_DATA)
  64.         return 0;
  65.     dup_p(&bpp,bp,1,AXALEN);
  66.     i = ax_forus(iface,bpp);
  67.     free_p(bpp);
  68.     return i;
  69. }
  70.